<#include "../header.html">
<script type="text/javascript">
function addCoach() {
	location.href = "baseAction.do?method=addcoach&baseId="+$("#baseId").val();
}
function editCoach() {
	var checkedBox = $("input[name=coachId]:checked");
	if(!checkedBox || checkedBox.length!=1){
		alert("请选择一条记录！");
		return false;
	}
	location.href = "baseAction.do?method=editCoach&baseId="+$("#baseId").val()+"&coachId="+$(checkedBox).val();
}
function delCoach() {
	var checkedBox = $("input[name=coachId]:checked");
	if(!checkedBox || checkedBox.length!=1){
		alert("请选择一条记录！");
		return false;
	}
	if(window.confirm("是否删除选中记录？")){
		ajaxPost("baseAction.do?method=deleteCoach", {coachId:$(checkedBox).val()}, function(data){
			endPageLoading();
			if(data["resultCode"] == 0){
				location.href = "baseAction.do?method=coach&dataId="+$("#baseId").val();
				return;
			}else{
				alert("删除错误");
				return false;
			}
		});
	}
}
</script>
<div class="c_nav">
	<span>管理选项：</span>
	<a href="baseAction.do?method=query">管理首页</a>
	<a href="javascript:location.reload()"> | [刷新页面]</a>
</div>
<div class="c_box bg_white">
	<div class="c_topic">${base.bname!}-教练列表</div>
	<!-- 如果需要横向滚动条加c_scroll_tr -->
	<button id="ADD_BTN_COACH" name="ADD_BTN_COACH" type="button" onclick="addCoach()"  class="e_btn">新增</button>
	<button id="EDIT_BTN_COACH" name="EDIT_BTN_COACH" type="button" onclick="editCoach()" class="e_btn">修改</button>
	<button id="DEL_BTN_COACH" name="DEL_BTN_COACH" type="button" onclick="delCoach()" class="e_btn">删除</button>
	<input type="hidden" name="baseId" id="baseId" value="${base.id!}"/>
	<div class="c_table e_center l_mt">
		<table bind="table" checkboxName="dataId" checkAllId="checkedAll">
        	<thead>
			<tr>
				<th></th>
				<th>名称</th>
				<th>性别</th>
				<th>电话</th>
				<th>费用(马力)</th>
			</tr>
            </thead>
            <tbody>
			<#list coachList as coach>
			<tr>
				<td><input type="checkbox" name="coachId" value="${coach.id!}"></td>
				<td>${coach.name!}</td>
				<td><if><#if coach.sex?? && coach.sex?string == '1'>男<#elseif coach.sex?? && coach.sex?string == '2'>女</#if></td>
				<td>${coach.mobile!}</td>
				<td>${coach.mali/100.0!}</td>
			<tr>
			</#list>
            </tbody>
		</table>
	</div>
</div>
<#include "../footer.html">